<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../../css/mine.css" />
    <link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_546019_o8qxm6fupb0ggb9.css" />
    <title>信息</title>
    <script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;">
				<img src="../../img/left.png" class="left" />
				<span>信息</span>
			</div>
		</div>-->
    <div class="mine-infor" style="margin-top: 0;">
        <div class="essen_list essen_list2 type1">
            <!--<p>
					<span>供应商编号</span>
					<b></b>
				</p>
				<p>
					<span>供应商名称</span>
					<b></b>
				</p>
				<p>
					<span>供应商地址</span>
					<b></b>
				</p>
				<p>
					<span>所在地</span>
					<b>湖北省武汉市</b>
				</p>-->
        </div>
        <div class="essen_list type2">

        </div>
        <div class="essen_list type3">

        </div>
        <ol class="material_photo_list">

        </ol>
        <!-- <div class="seePonderation">
            <a href="tradeHistory.html">查看历史交易</a>
        </div> -->

    </div>
    </div>
    <div class="weui-gallery" style="display: none">
        <!--图片预览-->
        <span class="weui-gallery__img"></span>
    </div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        baseConfig.historyBack();
        var username = localStorage.getItem("username");
        var fn = {};
        fn.type = function(num) {
            if (num == 0) {
                return "大客户"
            } else {
                return "小散户"
            }
        }
        fn.type2 = function(num) {
            if (num == 0) {
                return "三证合一与法人身份证"
            } else if (num == 1) {
                return "三证与法人身份证"
            } else {
                return "身份证"
            }
        }
        fn.type3 = function(num) {
            if (num == 0) {
                return "企业"
            } else {
                return "个人"
            }
        }
        if (!username) {
            $.confirm("尚未登录，是否去登录", function() {
                //点击确认后的回调函数
                window.location.href = "../login/login.html"
            }, function() {
                //点击取消后的回调函数
                history.back()
            });
        } else {
            $.ajax({
                type: "get",
                url: baseConfig.localHttp + "weChatApi/fgclient/getClientInfo",
                async: false,
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                data: {
                    username: username
                },
                success: function(data) {
                    $.hideLoading();
                    console.log(data)
                    if (data.code == 100) {
                        var content = data.content
                        $(".type1").html(
                            //<p><span>证件代表</span><b>" + fn.type2(content.clientPapersType) + "</b></p><p><span>法人代表</span><b>" + content.corporateRepresentative + "</b></p><p>备注</p><p class='last_p'>" + content.remarks + "</p>
                            // <p><span>供应商编号</span><b>"+content.no+"</b><p><span>所在地</span><b>" + content.clientArea.name + "</b></p><p><span>供应商性质</span><b>" + fn.type3(content.clientType) + "</b></p><p><span>供应商类型</span><b>" + fn.type(content.clientCategory) + "</b></p>
                            "</p><p><span>供应商名称</span><b>" + content.name + "</b></p><p><span>供应商地址</span><b>" + content.address + "</b></p>"
                        )
                        $(".type2").html(
                            "<p><span>公司电话</span><b>" + content.contact.tel + "</b></p><p><span>业务范围</span><b>" + content.scopeBusinessNames + "</b></p>"
                        )
                        $(".type3").html(
                                "<p><span>联系人</span><b>" + content.contact.name + "</b></p><p><span>联系人电话</span><b>" + content.contact.tel + "</b></p><p><span>联系人邮箱</span><b>" + content.contact.email + "</b></p>"
                            )
                            // var $img = ""
                            // if (!content.imgBusinessLicense) {

                        // } else {
                        //     $img += "<li><img src='" + baseConfig.imglocalHttp + content.imgBusinessLicense + "'/></li>"
                        // }
                        // if (!content.imgDuty) {

                        // } else {
                        //     $img += "<li><img src='" + baseConfig.imglocalHttp + content.imgDuty + "'/></li>"
                        // }
                        // if (!content.imgIdcardFan) {

                        // } else {
                        //     $img += "<li><img src='" + baseConfig.imglocalHttp + content.imgIdcardFan + "'/></li>"
                        // }
                        // if (!content.imgIdcardZheng) {

                        // } else {
                        //     $img += "<li><img src='" + baseConfig.imglocalHttp + content.imgIdcardZheng + "'/></li>"
                        // }
                        // if (!content.imgOrganizationCode) {

                        // } else {
                        //     $img += "<li><img src='" + baseConfig.imglocalHttp + content.imgOrganizationCode + "'/></li>"
                        // }
                        // $(".material_photo_list").append($img);
                        //点击图片预览
                        // $(".material_photo_list li img").on("click", function() {
                        //     var src = $(this).attr("src")
                        //     console.log(src)
                        //     $(".weui-gallery").show()
                        //     $(".weui-gallery__img").css("background-image", "url(" + src + ")")
                        //     $(".weui-gallery").on("click", function() {
                        //         $(this).hide()
                        //     })
                        // })
                    } else {
                        $.toptip(data.content, 1200, 'error');
                    }
                },
                error: function() {
                    $.hideLoading();
                    $.toast("请求失败", "cancel");
                }
            })
        }
    })
</script>

</html>